function CE_HHW_man = CE_HHW(Wi,iX,MU,CAPH,Nstates,rho,T,tolFP,maxreps,gamma)
    Y1 = Wi(:,1);
    Cg1 = HHW_cg(Y1,MU,CAPH,Nstates,rho,T,tolFP,maxreps);
    C = Consumption_HHW(Cg1,iX);
    u = -1/gamma*exp(-gamma*1000*C);
    Num = mean(sum(u.*(iX~=(Nstates+1)).*power(rho,(1:T)-1)',1));
    Den = mean(sum((iX~=(Nstates+1)).*power(rho,(1:T)-1)',1));    
    CE_HHW_man = -log(-gamma*Num/Den)/gamma;
end